import { Body, Controller, Get, Param, Post } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { ICalculateDailyCalories, IFindFood } from './pfc.dto';
import { PFCService } from './pfc.service';

@ApiTags('pfc')
@Controller('pfc')
export class PFCController {
    constructor(private PFCService: PFCService) {}

    @ApiOperation({
        description: 'find food characteristics',
    })
    @Post('add-food/:userTelegramId')
    async addNewFood(@Param('userTelegramId') userTelegramId: string, @Body() data: IFindFood) {
        return this.PFCService.addNewFood(userTelegramId, data);
    }

    @ApiOperation({
        description: 'get daily calories',
    })
    @Post('get-daily-calories/:userTelegramId')
    async calculateDailyCalories(
        @Param('userTelegramId') userTelegramId: string,
        @Body() data: ICalculateDailyCalories
    ) {
        return this.PFCService.calculateDailyCalories(userTelegramId, data);
    }

    @ApiOperation({
        description: 'get all foods today',
    })
    @Get('get-today-all-foods/:userTelegramId')
    async getAllFoodTodayByUser(@Param('userTelegramId') userTelegramId: string) {
        return await this.PFCService.getAllFoodTodayByUser(userTelegramId);
    }

    @ApiOperation({
        description: 'get count calories today',
    })
    @Get('get-today-count-calories/:userTelegramId')
    async getAllCaloriesTodayByUser(@Param('userTelegramId') userTelegramId: string) {
        return await this.PFCService.getAllCaloriesTodayByUser(userTelegramId);
    }
}
